<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>我的课程</title>
    <link rel="stylesheet" type="text/css" href="__CSS__api.css" />
    <link rel="stylesheet" type="text/css" href="__CSS__aui.css" />
    <link rel="stylesheet" type="text/css" href="__CSS__common.css" />
    <link rel="stylesheet" type="text/css" href="__CSS__dropload.css" />


    <style>
        .aui-bar-nav .aui-iconfont {
            position: relative;
            font-family: "aui_iconfont" !important;
            font-size: 0.75rem;
            color: #E73C5C;
            font-style: normal;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
            height: 2.4rem;
        }

        .aui-bar-nav {
            background-color: #fff;
        }

        .aui-icon-tu {
            height: 2.4rem;
            width: 49px;
            background: url('__IMG__left.png') no-repeat 0.5rem center;
            background-size: 22px 22px;
        }

        .aui-bar-nav .aui-pull-right {
            padding-right: 0.75rem;
        }

        .aui-bar-nav .aui-title {
            font-size: 0.9rem;
            color: #333333;
            font-weight: 500;
        }
        /*tab*/

        .aui-tab-item.aui-active {
            color: #E73C5C;
            font-weight: bold;
            font-size: 0.8rem;
            position: relative;
            border-bottom: 0;
        }

        .aui-active:after {
            content: '';
            display: block;
            height: 0px;
            width: 40%;
            border-top: 2px solid #E73C5C;
            bottom: 0px;
            left: 30%;
            position: absolute;
        }

        .sss {
            margin: 0px 15px;
            width: 100%;
        }

        .aui-tab-item {
            height: 2.4rem;
            line-height: 2.4rem;
            font-size: 0.8rem;
            color: #333;
        }
        body {
            background-color: #F5F5F5;
        }

        .right {
            position: relative;
        }

        .warrp {
            margin-top: 0.5rem;
            width: 100%;
            padding: 0 0.75rem;
            background-color: #fff;
        }

        .cooc {
            width: 100%;
            padding: 0.75rem 0;
            position: relative;
            background-color: #fff;
            /*left: 2rem;*/
        }
        /*/看样式 无意义/*/
        .cooc1 {
            width: 100%;
            padding: 0.75rem 0;
            position: relative;
            background-color: #fff;
            left: 2rem;
        }
        /*/看样式 无意义/*/
        .outAll {
            position: relative;
            z-index: 1;
        }

        .header {
            width: 4.8rem;
            width: 4.8rem;
            border-radius: 0.25rem;
        }

        .header img {
            width: 4.8rem;
            width: 4.8rem;
            border-radius: 0.25rem;
        }

        .title {
            font-size: 0.75rem;
            color: #333333;
            line-height: 0.85rem;
        }

        .cont {
            font-size: 0.65rem;
            color: #999;
            margin-top: 0.4rem;
        }

        .timefrom {
            display: flex;
            justify-content: space-between;
            font-size: 0.6rem;
            color: rgba(153, 153, 153, 1);
            position: absolute;
            bottom: 0;
            width: 100%;
        }

        .time {
            float: right;
        }

        .container {
            width: 100%;
            height: 3.5rem;
            background: #fff;
            position: fixed;
            bottom: 0;
            z-index: 1;
        }

        .signUp {
            width: 91.6%;
            height: 2.5rem;
            line-height: 2.5rem;
            font-size: 0.8rem;
            font-weight: 500;
            color: #fff;
            background: #E73C5C;
            text-align: center;
            margin: 0.5rem auto;
            border-radius: 0.25rem;
        }

        .select {
            width: 2.75rem;
            background-color: #fff;
            z-index: 0;
            position: absolute;
            left: -0.75rem;
            top: 0;
            height: 100%;
        }

        input[type="checkbox"] {
            -webkit-appearance: none;
            width: 100%;
            height: 100%;
            vertical-align: middle;
            background: #fff url(__IMG__uncheck.png) no-repeat center center;
            /*复选框的背景图，就是上图*/
            background-size: 1.1rem 1.1rem;
        }

        input[type="checkbox"]:checked {
            -webkit-appearance: none;
            width: 100%;
            height: 100%;
            vertical-align: middle;
            background: #fff url(__IMG__checked.png) no-repeat center center;
            /*复选框的背景图，就是上图*/
            background-size: 1.1rem 1.1rem;
        }
    </style>
</head>

<body>
<div class="l_box"  id="loading2"><img src="__IMG__loading.gif" alt="" id="loading"></div>

<header class="aui-bar aui-bar-nav underLine" style="padding-top:25px;" id="header">
    <a class="aui-pull-left" tapmode="active" onclick="history.go(-1)"> <span class="aui-iconfont aui-icon-tu"> </span> </a>
    <div class="aui-title">我的课程</div>
    <a class="aui-pull-right">
        <span class="aui-iconfont" tapmode="active" onclick="right()" id="edit">编辑</span>
    </a>
</header>
<div class="aui-tab bar underLine" id="tab1">
    <div class="underLine sss aui-tab" id="tab">
        <div class="aui-tab-item" id="sc" onclick="sc()">我的收藏</div>
        <div class="aui-tab-item  aui-active" id="ls">观看历史</div>
        <div class="aui-tab-item"  id="sp" onclick="sp()" style="display: none;">本地视频</div>
    </div>
</div>
<div class="upOrDown" style="margin-bottom: 3rem;">
    <div class="upOrDown_data">
        <div class="shouc hidden" id="shoucang">
            <div class="kong" style="margin-top:5.8rem" id="kong">
                <img src="__IMG__quesheng/no_collect.png" class="">
                <div class="seatName1">暂无收藏</div>
            </div>
            <div class="warrp">
                <!--<div class="outAll">-->
                <!--<div class="select"><input type="checkbox" name="zixun" checked></div>-->
                <!--<div class="cooc underLine flex-wrap shoucang">-->
                <!--<div class="header">-->
                <!--<img src="__IMG__jingtaitu/main1_pinglun.png" alt="">-->
                <!--</div>-->
                <!--<div class="right flex-con" style="margin-left:0.8rem">-->
                <!--<div class="title aui-ellipsis-1">-->
                <!--这里是标题一共有亿行行行行行这里是标题一共有亿行行行行行...-->
                <!--</div>-->
                <!--<div class="cont aui-ellipsis-1" style="">-->
                <!--已观看67%-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
                <!--<div class="outAll" style="margin-bottom: 3rem;">-->
                <!--<div class="select"><input type="checkbox" name="zixun" checked></div>-->
                <!--<div class="cooc underLine flex-wrap shoucang">-->
                <!--<div class="header">-->
                <!--<img src="__IMG__jingtaitu/main1_pinglun.png" alt="">-->
                <!--</div>-->
                <!--<div class="right flex-con" style="margin-left:0.8rem">-->
                <!--<div class="title aui-ellipsis-1">-->
                <!--这里是标题一共有亿行行行行行这里是标题一共有亿行行行行行...-->
                <!--</div>-->
                <!--<div class="cont aui-ellipsis-1" style="">-->
                <!--已看完-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
                <!--<div class="outAll" style="margin-bottom: 3rem;">-->
                <!--<div class="select"><input type="checkbox" name="zixun" checked></div>-->
                <!--<div class="cooc underLine flex-wrap shoucang">-->
                <!--<div class="header">-->
                <!--<img src="__IMG__jingtaitu/main1_pinglun.png" alt="">-->
                <!--</div>-->
                <!--<div class="right flex-con" style="margin-left:0.8rem">-->
                <!--<div class="title aui-ellipsis-1">-->
                <!--这里是标题一共有亿行行行行行这里是标题一共有亿行行行行行...-->
                <!--</div>-->
                <!--<div class="cont aui-ellipsis-1" style="">-->
                <!--已看完-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
                <!--<div class="outAll" style="margin-bottom: 3rem;">-->
                <!--<div class="select"><input type="checkbox" name="zixun" checked></div>-->
                <!--<div class="cooc underLine flex-wrap shoucang">-->
                <!--<div class="header">-->
                <!--<img src="__IMG__jingtaitu/main1_pinglun.png" alt="">-->
                <!--</div>-->
                <!--<div class="right flex-con" style="margin-left:0.8rem">-->
                <!--<div class="title aui-ellipsis-1">-->
                <!--这里是标题一共有亿行行行行行这里是标题一共有亿行行行行行...-->
                <!--</div>-->
                <!--<div class="cont aui-ellipsis-1" style="">-->
                <!--已看完-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
                <!--<div class="outAll" style="margin-bottom: 3rem;">-->
                <!--<div class="select"><input type="checkbox" name="zixun" checked></div>-->
                <!--<div class="cooc underLine flex-wrap shoucang">-->
                <!--<div class="header">-->
                <!--<img src="__IMG__jingtaitu/main1_pinglun.png" alt="">-->
                <!--</div>-->
                <!--<div class="right flex-con" style="margin-left:0.8rem">-->
                <!--<div class="title aui-ellipsis-1">-->
                <!--这里是标题一共有亿行行行行行这里是标题一共有亿行行行行行...-->
                <!--</div>-->
                <!--<div class="cont aui-ellipsis-1" style="">-->
                <!--已看完-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
                <!--<div class="outAll" style="margin-bottom: 3">-->
                <!--<div class="select"><input type="checkbox" name="zixun" checked></div>-->
                <!--<div class="cooc underLine flex-wrap shoucang">-->
                <!--<div class="header">-->
                <!--<img src="__IMG__jingtaitu/main1_pinglun.png" alt="">-->
                <!--</div>-->
                <!--<div class="right flex-con" style="margin-left:0.8rem">-->
                <!--<div class="title aui-ellipsis-1">-->
                <!--这里是标题一共有亿行行行行行这里是标题一共有亿行行行行行...-->
                <!--</div>-->
                <!--<div class="cont aui-ellipsis-1" style="">-->
                <!--已看完-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
            </div>

        </div>




        <div class="lish" id="lishi">
            <div class="kong" style="margin-top:5.8rem" >
                <img src="__IMG__quesheng/no_collect.png" class="">
                <div class="seatName1">暂无观看历史</div>
            </div>
            <div class="warrp">
                <!--<div class="outAll">-->
                <!--<div class="select"><input type="checkbox" name="zixun" checked></div>-->
                <!--<div class="cooc underLine flex-wrap lishi">-->
                <!--<div class="header">-->
                <!--<img src="__IMG__jingtaitu/main1_pinglun.png" alt="">-->
                <!--</div>-->
                <!--<div class="right flex-con" style="margin-left:0.8rem">-->
                <!--<div class="title aui-ellipsis-1">-->
                <!--这里是标题一共有亿行行行行行这里是标题一共有亿行行行行行...-->
                <!--</div>-->
                <!--<div class="cont aui-ellipsis-1" style="">-->
                <!--已观看67%-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
                <!--<div class="outAll">-->
                <!--<div class="select"><input type="checkbox" name="zixun" checked></div>-->
                <!--<div class="cooc underLine flex-wrap lishi">-->
                <!--<div class="header">-->
                <!--<img src="__IMG__jingtaitu/main1_pinglun.png" alt="">-->
                <!--</div>-->
                <!--<div class="right flex-con" style="margin-left:0.8rem">-->
                <!--<div class="title aui-ellipsis-1">-->
                <!--这里是标题一共有亿行行行行行这里是标题一共有亿行行行行行...-->
                <!--</div>-->
                <!--<div class="cont aui-ellipsis-1" style="">-->
                <!--已看完-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
                <!--<div class="outAll">-->
                <!--<div class="select"><input type="checkbox" name="zixun" checked></div>-->
                <!--<div class="cooc underLine flex-wrap lishi">-->
                <!--<div class="header">-->
                <!--<img src="__IMG__jingtaitu/main1_pinglun.png" alt="">-->
                <!--</div>-->
                <!--<div class="right flex-con" style="margin-left:0.8rem">-->
                <!--<div class="title aui-ellipsis-1">-->
                <!--这里是标题一共有亿行行行行行这里是标题一共有亿行行行行行...-->
                <!--</div>-->
                <!--<div class="cont aui-ellipsis-1" style="">-->
                <!--已看完-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
                <!--<div class="outAll">-->
                <!--<div class="select"><input type="checkbox" name="zixun" checked></div>-->
                <!--<div class="cooc underLine flex-wrap lishi">-->
                <!--<div class="header">-->
                <!--<img src="__IMG__jingtaitu/main1_pinglun.png" alt="">-->
                <!--</div>-->
                <!--<div class="right flex-con" style="margin-left:0.8rem">-->
                <!--<div class="title aui-ellipsis-1">-->
                <!--这里是标题一共有亿行行行行行这里是标题一共有亿行行行行行...-->
                <!--</div>-->
                <!--<div class="cont aui-ellipsis-1" style="">-->
                <!--已看完-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
                <!--<div class="outAll">-->
                <!--<div class="select"><input type="checkbox" name="zixun" checked></div>-->
                <!--<div class="cooc underLine flex-wrap lishi">-->
                <!--<div class="header">-->
                <!--<img src="__IMG__jingtaitu/main1_pinglun.png" alt="">-->
                <!--</div>-->
                <!--<div class="right flex-con" style="margin-left:0.8rem">-->
                <!--<div class="title aui-ellipsis-1">-->
                <!--这里是标题一共有亿行行行行行这里是标题一共有亿行行行行行...-->
                <!--</div>-->
                <!--<div class="cont aui-ellipsis-1" style="">-->
                <!--已看完-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
                <!--<div class="outAll">-->
                <!--<div class="select"><input type="checkbox" name="zixun" checked></div>-->
                <!--<div class="cooc underLine flex-wrap lishi">-->
                <!--<div class="header">-->
                <!--<img src="__IMG__jingtaitu/main1_pinglun.png" alt="">-->
                <!--</div>-->
                <!--<div class="right flex-con" style="margin-left:0.8rem">-->
                <!--<div class="title aui-ellipsis-1">-->
                <!--这里是标题一共有亿行行行行行这里是标题一共有亿行行行行行...-->
                <!--</div>-->
                <!--<div class="cont aui-ellipsis-1" style="">-->
                <!--已看完-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
                <!--<div class="outAll" style="margin-bottom:3rem;">-->
                <!--<div class="select"><input type="checkbox" name="zixun" checked></div>-->
                <!--<div class="cooc underLine flex-wrap lishi">-->
                <!--<div class="header">-->
                <!--<img src="__IMG__jingtaitu/main1_pinglun.png" alt="">-->
                <!--</div>-->
                <!--<div class="right flex-con" style="margin-left:0.8rem">-->
                <!--<div class="title aui-ellipsis-1">-->
                <!--这里是标题一共有亿行行行行行这里是标题一共有亿行行行行行...-->
                <!--</div>-->
                <!--<div class="cont aui-ellipsis-1" style="">-->
                <!--已看完-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
            </div>

        </div>




        <div class="bend hidden" id="bendi">
            <div class="kong" style="margin-top:5.8rem" id="kong">
                <img src="__IMG__quesheng/no_collect.png" class="">
                <div class="seatName1">暂无本地视频</div>
            </div>
            <div class="warrp">
                <div class="outAll">
                    <div class="select"><input type="checkbox" name="zixun" checked></div>
                    <div class="cooc underLine flex-wrap bendi">
                        <div class="header">
                            <img src="__IMG__jingtaitu/main1_pinglun.png" alt="">
                        </div>
                        <div class="right flex-con" style="margin-left:0.8rem">
                            <div class="title aui-ellipsis-1">
                                这里是标题一共有亿行行行行行这里是标题一共有亿行行行行行...
                            </div>
                            <div class="aui-content-padded">

                                <div class="aui-progress aui-progress-xxs">
                                    <div class="aui-progress-bar" style="width: 60%;"></div>
                                </div>
                            </div>
                            <div class="cont aui-ellipsis-1" style="">
                                已观看67% <span style="float:right;">下载完成</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="outAll" style="margin-bottom: 3rem;">
                    <div class="select"><input type="checkbox" name="zixun" checked></div>
                    <div class="cooc underLine flex-wrap bendi">
                        <div class="header">
                            <img src="__IMG__jingtaitu/main1_pinglun.png" alt="">
                        </div>
                        <div class="right flex-con" style="margin-left:0.8rem">
                            <div class="title aui-ellipsis-1">
                                这里是标题一共有亿行行行行行这里是标题一共有亿行行行行行...
                            </div>
                            <div class="cont aui-ellipsis-1" style="">
                                已看完<span style="float:right;">下载完成</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
    <div class="container topLine hidden" onclick="deletesc()" tapmode='active'>
        <div class="signUp">删除</div>
    </div>
    <div class="container topLine hidden" onclick="deletelishi()" tapmode='active'>
        <div class="signUp">删除</div>
    </div>
    <div class="container topLine hidden" onclick="fnSubmit()" tapmode='active'>
        <div class="signUp">删除2</div>
    </div>
</div>
<div class="toast-wrap">
    <span class="toast-msg"></span>
</div>
</body>

<script type="text/javascript" src="__JS__jquery.min.js"></script>
<script type="text/javascript" src="__JS__layer_mobile/layer.js"></script>
<script type="text/javascript" src="__JS__dropload.min.js"></script>
<script type="text/javascript" src="__JS__api.js"></script>
<script type="text/javascript" src="__JS__tt.js"></script>
<script type="text/javascript" src="__JS__common.js"></script>
<script type="text/javascript">
    window.onload = function() {
        //    获取我的收藏，观看历史，本地视屏

    };
    var isfirst=true;
    function getalldata() {
        isfirst=true;
        getdata_shoucang();
        getdata_guangkan();

    }

    var clicknum=1;
    var editstatu=0;
    var bendi=document.getElementsByClassName('bendi');
    var shoucang=document.getElementsByClassName('shoucang');
    var lishi=document.getElementsByClassName('lishi');

    var container=document.getElementsByClassName('container');

    var edit=document.getElementById("edit");
    var page = 0;
    /**
     * 上拉加载，下拉刷新
     */

    var dropload = $('.upOrDown').dropload({
        scrollArea : window,
        autoLoad : true,
//        domUp : {
//            domClass   : 'dropload-up',
//            domRefresh : '<div class="dropload-refresh">↓下拉刷新-自定义内容</div>',
//            domUpdate  : '<div class="dropload-update">↑释放更新-自定义内容</div>',
//            domLoad    : '<div class="dropload-load"><span class="loading"></span>加载中-自定义内容...</div>'
//        },
//        domDown : {
//            domClass   : 'dropload-down',
//            domRefresh : '<div class="dropload-refresh">刷新</div>',
//            domLoad    : '<div class="dropload-load"><span class="loading"></span>加载中...</div>',
//            domNoData  : '<div class="dropload-noData">无数据</div>'
//        },
        loadDownFn : function(me){
            console.log('下拉刷新');
            var url='';
            url='{:url("my/histroyclass")}';

            page++;
            console.log(url);
            $.ajax({
                url:url,
                data:'page='+page,//
                type:'POST',
                dataType:'JSON',
                success: function(data){
                    var arrLen = data.msg.length;
                    if(arrLen<=0){
                        me.lock();
//                         无数据
                        me.noData(true);
                        // 每次数据加载完，必须重置
                        me.resetload();
                    }else{
                        var datas = data.msg;
                        getlist_guankan(datas);
                        // 每次数据加载完，必须重置
                        me.resetload();
                    }
                },
                error: function(xhr, type){
                    alert('Ajax error!');
                    // 即使加载出错，也得重置
                    me.resetload();
                }
            });
        },
        loadUpFn : function(me){
            var url='';
            url='{:url("my/histroyclass")}';
            page = 1;
            $.ajax({
                url:url,
                data:'page='+page,
                type:'POST',
                dataType:'json',
                success: function(data){
                    console.log(data);
                    // $('.upOrDown_data').empty();
                    $('.warrp').eq(1).empty();
                    var datas = data.msg;
                    getlist_guankan(datas);

                    me.resetload();
                    me.unlock();
                    me.noData(false);
                },
                error: function(xhr, type){
                    me.resetload();
                }
            });
        }
    });

    function right() {
        bendi=document.getElementsByClassName('bendi');
        shoucang=document.getElementsByClassName('shoucang');
        lishi=document.getElementsByClassName('lishi');
        container=document.getElementsByClassName('container');
        if (clicknum==0){
            if (editstatu==0) {
                edit.innerHTML='取消';
                editstatu=1;
                for (var i=0;i<shoucang.length;i++) {
                    shoucang[i].style.left='2rem';
                }
                container[0].style.display='block';
            }else {
                edit.innerHTML='编辑';
                editstatu=0;
                for (var i=0;i<shoucang.length;i++) {
                    shoucang[i].style.left='0rem';
                }
                container[0].style.display='none';
            }
        }else if (clicknum==1) {
            if (editstatu==0) {
                edit.innerHTML='取消';
                editstatu=1;

                for (var i=0;i<lishi.length;i++) {
                    lishi[i].style.left='2rem';
                }
                container[1].style.display='block';

            }else {
                edit.innerHTML='编辑';
                editstatu=0;
                for (var i=0;i<lishi.length;i++) {
                    lishi[i].style.left='0rem';
                }
                container[1].style.display='none';

            }

        }else {
            if (editstatu==0) {
                edit.innerHTML='取消';
                editstatu=1;
                for (var i=0;i<bendi.length;i++) {
                    bendi[i].style.left='2rem';
                }
                container[2].style.display='block';

            }else {
                edit.innerHTML='编辑';
                editstatu=0;
                for (var i=0;i<bendi.length;i++) {
                    bendi[i].style.left='0rem';
                }
                container[2].style.display='none';

            }
        }
    }
    function sc(){
        location.href='{:url("My/my_class")}';

        // bendi=document.getElementsByClassName('bendi');
        // shoucang=document.getElementsByClassName('shoucang');
        // lishi=document.getElementsByClassName('lishi');
        // container=document.getElementsByClassName('container');
        // if (clicknum==0) {
        //     return;
        // }
        // getdata_shoucang();
        //
        // edit.innerHTML='编辑';
        // editstatu=0;
        // for (var i=0;i<lishi.length;i++) {
        //     lishi[i].style.left='0rem';
        // }
        // container[1].style.display='none';
        // for (var i=0;i<bendi.length;i++) {
        //     bendi[i].style.left='0rem';
        // }
        // container[2].style.display='none';
        // clicknum=0;
        //
        // document.getElementById("shoucang").className='shouc';
        // document.getElementById("lishi").className='lish hidden';
        // document.getElementById("bendi").className='bend hidden';
        // document.getElementById("sc").className='aui-tab-item aui-active';
        // document.getElementById("ls").className='aui-tab-item';
        // document.getElementById("sp").className='aui-tab-item';
    }
    function ls(){
        bendi=document.getElementsByClassName('bendi');
        shoucang=document.getElementsByClassName('shoucang');
        lishi=document.getElementsByClassName('lishi');
        container=document.getElementsByClassName('container');
        if (clicknum==1) {
            return;
        }
        getdata_guangkan();
        edit.innerHTML='编辑';
        editstatu=0;
        for (var i=0;i<shoucang.length;i++) {
            shoucang[i].style.left='0rem';
        }
        container[0].style.display='none';
        for (var i=0;i<bendi.length;i++) {
            bendi[i].style.left='0rem';
        }
        container[2].style.display='none';
        clicknum=1;

        document.getElementById("shoucang").className='shouc hidden';
        document.getElementById("lishi").className='lish';
        document.getElementById("bendi").className='bend hidden';
        document.getElementById("sc").className='aui-tab-item';
        document.getElementById("ls").className='aui-tab-item aui-active';
        document.getElementById("sp").className='aui-tab-item';
    }
    function sp(){
        if (clicknum==2) {
            return;
        }
        edit.innerHTML='编辑';
        editstatu=0;
        for (var i=0;i<shoucang.length;i++) {
            shoucang[i].style.left='0rem';
        }
        container[0].style.display='none';
        for (var i=0;i<lishi.length;i++) {
            lishi[i].style.left='0rem';
        }
        container[1].style.display='none';
        clicknum=2;
        document.getElementById("shoucang").className='shouc hidden';
        document.getElementById("lishi").className='lishi hidden';
        document.getElementById("bendi").className='bendi';
        document.getElementById("sc").className='aui-tab-item';
        document.getElementById("ls").className='aui-tab-item';
        document.getElementById("sp").className='aui-tab-item aui-active';
    }
    //    获取我的收藏数据
    function getdata_shoucang() {
        loaddingOpen();

        page++;
        $.ajax({
            url:'{:url("My/myclasscollection")}',
            type: 'post',
            data:'page='+0,//
            processData: false,
            contentType: false,
            success: function (data) {
                loaddingClose();
                if (data.status=='200') {
                    if (data.msg.length>0){
                        getlist_shoucang(data.msg);
                    }else {

                        $('.warrp').eq(0).html('');
                        // $('.kong').eq(0).show();
                    }
                }else {

                    toast(data.msg);
                }
            },
            error: function(xhr, type){
                loaddingClose();

                toast('无网络或连接超时，请重试！');
                // 即使加载出错，也得重置

            }
        });


    }

    //    把获取的我的收藏列表化
    function getlist_shoucang(data) {
        var html='';
        for (var i=0;i<data.length;i++) {
            if (i==data.length-1) {
                html+='<div class="outAll">';
            }else {
                html+='<div class="outAll">';

            }
            html+='<div class="select"><input class="scbutton" type="checkbox" name="zixun" checked data-id="'+data[i].id+'"></div>';
            html+='<div class="cooc underLine flex-wrap shoucang" onclick="opendetail('+data[i].classroom_id+')">';
            html+='<div class="header">';
            html+='<img src="'+data[i].classroom_img+'" alt="">';
            html+='</div>';
            html+='<div class="right flex-con" style="margin-left:0.8rem">';
            html+='<div class="title aui-ellipsis-1">'+data[i].classroom_title+'</div>';
            html+='<div class="cont aui-ellipsis-1" style=""> 已观看'+data[i].classroom_progress+'</div>';
            html+='</div></div></div>';
        }
        $('.warrp').eq(0).append(html)
    }
    // 获取观看历史histroyclass
    function getdata_guangkan() {
        loaddingOpen();
        page++;
        $.ajax({
            url:'{:url("My/histroyclass")}',
            type: 'post',
            data:'page='+0,//
            processData: false,
            contentType: false,
            success: function (data) {
                loaddingClose();
                console.log(data);
                if (data.status=='200') {
                    if (data.msg.length>0){
                        getlist_guankan(data.msg);
                    }else {

                        $('.warrp').eq(1).html('');
                        // $('.kong').eq(1).show();
                    }
                }else {

                    toast(data.msg);
                }
            },
            error: function(xhr, type){
                loaddingClose();

                toast('无网络或连接超时，请重试！');
                // 即使加载出错，也得重置

            }
        });


    }
    //    把获取的观看历史列表化

    function getlist_guankan(data) {
        var html='';
        for (var i=0;i<data.length;i++) {
            if (i==data.length-1) {
                html+='<div class="outAll">';
            }else {
                html+='<div class="outAll">';

            }
            html+='<div class="select"><input class="lishibutton" type="checkbox" name="zixun" checked data-id="'+data[i].history_id+'"></div>';
            html+='<div class="cooc underLine flex-wrap lishi" onclick="opendetail('+data[i].classroom_id+')">';
            html+='<div class="header">';
            html+='<img src="'+data[i].classroom_img+'" alt="">';
            html+='</div>';
            html+='<div class="right flex-con" style="margin-left:0.8rem">';
            html+='<div class="title aui-ellipsis-1">'+data[i].classroom_title+'</div>';
            html+='<div class="cont aui-ellipsis-1" style=""> 已观看'+data[i].classroom_progress+'</div>';
            html+='</div></div></div>';
        }
            $('.warrp').eq(1).append(html);

    }
    //    删除收藏deletemyclass
    function deletesc() {
        var scbutton=document.getElementsByClassName('scbutton');
        var deletelist=[];
        for (var i=0;i<scbutton.length;i++){
            if (scbutton[i].checked) {
                deletelist.push(scbutton[i].dataset.id);
            }
        }
        if (deletelist.length==0) {
            toast('请选择要删除的选项');
            return;
        }
        loaddingOpen();

        var data='';
        for (var i=0;i<deletelist.length;i++) {
            if (i==0) {
                data+=deletelist[i];
            }else {
                data+=',';
                data+=deletelist[i];
            }
        }
        console.log(data);
        var  type=1;

        $.ajax({
            url:'{:url("My/deletemyclass")}',
            type: 'post',
            data:{type:type,id:data},
            dataType:'JSON',

            success: function (data) {
                loaddingClose();
                console.log(data);
                if (data.status=='200') {
                    toast('删除成功');
                    window.location.reload();
                }else {

                    toast(data.msg);
                }
            },
            error: function(xhr, type){
                loaddingClose();

                toast('无网络或连接超时，请重试！');
                // 即使加载出错，也得重置

            }
        });

    }
    // 删除观看历史deletemyclass
    function deletelishi() {

        var lsbutton=document.getElementsByClassName('lishibutton');
        var deletelist=[];
        for(var i=0;i<lsbutton.length;i++){
            if (lsbutton[i].checked) {
                deletelist.push(lsbutton[i].dataset.id);
            }
        }
        if (deletelist.length==0) {
            toast('请选择要删除的选项');
            return;
        }
        loaddingOpen();

        var data='';
        for (var i=0;i<deletelist.length;i++) {
            if (i==0) {
                data+=deletelist[i];
            }else {
                data+=',';
                data+=deletelist[i];
            }
        }
        console.log(data);
        var  type=2;
        var data2={
            type:type,history_id:data
        };

        console.log(data2);
        $.ajax({
            url:'{:url("My/deletemyclass")}',
            type: 'post',
            data:data2,
            dataType:'JSON',

            success: function (data) {
                loaddingClose();
                console.log(data);
                if (data.status=='200') {
                    toast('删除成功');
                    window.location.reload();
                }else {

                    toast(data.msg);
                }
            },
            error: function(xhr, type){
                loaddingClose();

                toast('无网络或连接超时，请重试！');
                // 即使加载出错，也得重置

            }
        });
    }


    // 进入详情页面
    function opendetail(id) {
        location.href ='http://share.verynurse.com/share/html/main3/classroomdetail.html?id11='+id+"&user="+45;
    }



</script>

</html>
